home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / coding / 80x86 / code32.lzh / COPYMEM.RT < prev    next >
Text File  |  1993-01-09  |  679b  |  31 lines

  1. public  _copymem
  2. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  3. ; Copy a block of memory to another (possibly overlapping) location
  4. ; In:
  5. ;   ECX - length of block
  6. ;   ESI -> source
  7. ;   EDI -> destination
  8. ; Out:
  9. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  10. _copymem:
  11.         push ax
  12.         push ecx
  13.         push esi
  14.         push edi
  15.         cmp esi,edi
  16.         jae short copymemf0
  17.         add esi,ecx
  18.         add edi,ecx
  19.         dec esi
  20.         dec edi
  21.         std
  22. copymemf0:
  23.         rep movsb
  24.         cld
  25.         pop edi
  26.         pop esi
  27.         pop ecx
  28.         pop ax
  29.         ret
  30.  
  31.